<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Dashboard Template for Bootstrap</title>
    <link rel="stylesheet" th:href="@{/css/common.css}">
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
    <link th:href="@{/css/dashboard.css}" rel="stylesheet">


</head>

<body>
<!--导航栏-->
<div th:insert="~{commons/commons::navbar}"></div>

<div class="container-fluid">
    <div class="row">

        <!--侧边栏-->
        <div th:insert="~{commons/commons::sidebar(active='carManage')}"></div>

        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">

            <form class="form-inline m-b-md" action="/carManage/carList">
                <div class="form-group">
                    <label class="text-lg m-lr-md">类型:</label>
                    <select name="id" class="form-control">
                        <option style='display: none'></option>
                        <option th:each="type:${carType}" th:text="${type.getName()}" th:value="${type.getId()}"></option>
                    </select>
                </div>

                <div class="form-group">
                    <label class="text-lg m-l-md m-r-md">状态:</label>
                    <select  name="stateId" class="form-control" >
                        <option style='display: none'></option>
                        <option th:each="state:${carState}" th:text="${state.getName()}" th:value="${state.getId()}"></option>
                    </select>
                </div>


                <div class="form-group">
                    <label class="text-lg m-l-md m-r-md">搜索：</label>
                    <input type="text" class="form-control"name="search">
                </div>


                <div class="form-group m-l-lg">
                    <button class="btn btn-default" type="submit">查询</button>
                </div>


            </form>

            <div class="table-responsive">
                <table class="table table-striped table-sm">
                    <thead>
                    <tr>
                        <th width="100px" height="36px" class="text-md">车牌号</th>
                        <th width="100px" height="36px" class="text-md">类型</th>
                        <th width="100px" height="36px" class="text-md">品牌</th>
                        <th width="100px" height="36px" class="text-md">核载人数</th>
                        <th width="120px" height="36px" class="text-md">使用用户数</th>
                        <th width="100px" height="36px" class="text-md">状态</th>
                        <th width="160px" height="36px" class="text-md">更新时间</th>
                        <th height="36px" class="text-md">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="car:${data.getList()}">
                        <td height="24px" class="text-md" th:text="${car.getPlate_code()}"></td>
                        <td height="24px" class="text-md" th:text="${car.getType_name()?:'-'}"></td>
                        <td height="24px" class="text-md" th:text="${car.getBrand()?:'-'}"></td>
                        <td height="24px" class="text-md" th:text="${car.getApproved_num()?:'-'}"></td>
                        <td height="24px" class="text-md" th:text="${car.getUser_num()}"></td>
                        <td height="24px" class="text-md" th:text="${car.getState_name()?:'-'}"></td>
                        <td height="24px" class="text-md" th:text="${#dates.format(car.getTime_update_last(),'yyyy-MM-dd HH:mm')}"></td>
                        <td height="24px" class="text-md">
                            <a class="btn btn-sm btn-primary" th:href="@{/carManage/carDetail?aid=}+${car.getAid()}">详情</a>
                            <a class="btn btn-sm btn-success" th:href="@{/carManage/carInfo?aid=}+${car.getAid()}">编辑</a>
                            <form class="d-xl-inline-block" th:action="@{/carManage/delCar?aid=}+${car.getAid()}" method="post">
                                <button class="btn btn-sm btn-danger"  type="submit">删除</button>
                            </form>
                        </td>
                    </tr>
                    </tbody>
                </table>

                <form class="form-inline m-b-md" action="/carManage/carList">
                    <div class="text-lg" th:text="'查询到 '+${data.getRowsNum()}+' 条数据，'+'当前为第 '+${data.getPage()}+' 页,每页最多显示 '+${data.getPageNum()+' 条数据'}"></div>

                    <div class="form-group">
                        <label class="text-lg m-l-lg m-r-md">跳转到:</label>
                        <select name="page" class="form-control">
                            <option th:each="index:${indexs}" th:text="'第'+${index}+'页'" th:value="${index}"></option>
                        </select>
                    </div>
                    <div class="form-group m-l-lg">
                        <button class="btn btn-default" >GO</button>
                    </div>
                </form>


            </div>

        </main>

    </div>
</div>

<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" th:src="@{/js/jquery-3.5.1.slim.min.js}"></script>
<script type="text/javascript" th:src="@{/js/popper.min.js}"></script>
<script type="text/javascript" th:src="@{/js/bootstrap.min.js}"></script>

<!-- Icons -->
<script type="text/javascript" th:src="@{/js/feather.min.js}"></script>

</body>

</html>